<template>
	<view class="container">
		<view class="header">
			<view class="header-title-left">欢迎来到盐池零工平台自助系统</view>
			<view class="back" @click="goBack"><uni-icons type="left" size="30"></uni-icons>返回</view>
			<view class="header-title">
				<view>零工行业</view>
			</view>
		</view>
		<view class="stats">
			<view class="stat-item" v-for="(item, index) in stats" :key="index" @click="next(item)">
				<view class="stat-value-container">
					<view class="stat-title">{{ item }}</view>
				</view>
			</view>
		</view>

		<!-- <view class="footer">
            <view class="footer-title">
                当前用户信息：
            </view>
            <view>王**  6403**********0018</view>
            <view @click="loginOut" style="color: blue;">【退出】</view>
        </view> -->

		<!-- <Message /> -->

	</view>

</template>

<script>
	import {
		industry
	} from 'api/worker/index.js';
	export default {

		onLoad() {
			// const auth = this.$u.auth.check();
			this.getIndustry();
		},
		data() {
			return {
				stats: [],
			};
		},
		methods: {
			// 获取行业数据
			getIndustry() {
				industry().then((res) => {
					console.log('res', res);
					this.stats = res.data;
				})
			},
			toggle() {
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				// this.$refs.popup.open('center')
				uni.$u.route({
					url: 'pages/home/message'
				})
			},
			goBack() {
				uni.navigateBack()
			},
			next(item) {
				uni.$u.route({
					url: 'pages/worker/classify',
					params: {
						name: item
					}
				})
			},
			loginOut() {
				return;
				logOut().then(() => {

				})
			}
		},

		components: {
			Message: () => import('../common/message.vue')
		}
	}
</script>

<style lang="less" scoped>
	/* 基础样式 */
	body,
	page {
		font-family: Arial, sans-serif;
		background-color: #f4f6fa;
		margin: 0;
		padding: 0;
	}

	.container {
		display: flex;
		flex-direction: column;
		align-items: center;
		// justify-items: center;
		height: 100vh;
		/* background-color: #CBE1FB; */
		/* 背景颜色 */
		background-image: url('../../static/images/background_2.png');
		/* 背景图片 */
		// background-size: cover;
		background-position: center;
		background-blend-mode: multiply;
		/* 背景混合模式，使颜色和图片叠加 */
	}

	.header {
		padding: 50px;
		width: 90%;

		position: relative;

		.header-title-left {
			text-align: left;
			font-size: 32px;
			color: #384161;
			width: 100%;
		}

		.header-title {
			text-align: center;
			font-size: 120px;
			font-weight: 600;
			color: #4B81FF;
			width: 100%;
			margin: 100px auto 50px;
			/* 使文本居中时占据整行 */


		}

		.back {
			position: absolute;
			font-size: 24px;
			color: #384161;
			line-height: 0px;
			width: 80px;
			height: 40px;
			left: 46px;
			top: 120px;
			/* 自动布局 */
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			border: 1px solid #fff;
			box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
			padding: 8px 24px 8px 24px;
		}
	}


	.stats {
		display: flex;
		// justify-content: space-around;
		flex-wrap: wrap;
		width: 98%;
		margin: 0 auto 150px;
	}

	.stat-item {
		width: 20%;
		height: 60px;
		background-color: #FFFFFF33;
		/* 背景透明 */
		border-radius: 10px;
		box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
		/* opacity: 0.2; */
		padding: 20px 10px;
		text-align: center;
		margin: 20px 14px;
		display: flex;
		flex-direction: column;
		/* 上下结构 */
		align-items: center;
		border: 2px solid #fff;
	}

	.stat-value-container {
		font-size: 22px;
		font-weight: bold;
		color: #384161;
		line-height: 60px;
	}


	.footer {
		position: fixed;
		left: 40px;
		bottom: 20px;
		display: flex;
		width: 90%;
		font-size: 22px;
		font-weight: 600;

		.footer-title {
			color: #4B81FF;
		}
	}
</style>